namespace OpenPms.Areas.D.Pages.Setup.Rate;

public class EditPriceBeforeModel : PageModel
{
    public async Task<IActionResult> OnGetAsync([FromServices] Data.AppDbContext db, Guid rateId, string rateName, int? hourRoomLength)
    {
        var item = await db.Rates.FindAsync(rateId);
        if (item == null || item.HotelId != User.GetExtId())
            return NotFound();
        TempData.Save("RateId", rateId);
        TempData.Save("RateName", rateName);
        TempData.Save("IsDelayPrice", hourRoomLength.HasValue);
        return RedirectToPage("./EditPrice");
    }
}
